﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace personalplaner.common.converters
{
	public class NullToBoolConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null)
				return true;

			return false;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value is bool && (bool)value)
				return parameter;

			return null;
		}
	}
}
